STATISTICAL ANALYSES on DCZ vs Sham sessions
(Note we have no injection pre-surgery )
Here are the analyses and description of data for the 2 main types of
sessions used on DCZ conditions. We subset the data for just the 2
monkeys and the 2 session types with an injection (sham and DCZ). We
will also go through some more measures:
- test the numbers of repeats, and length distribution of distance to
repeat
- test the number of pauses (code 99)
ATTENTION we remove the CONTROL sessions!!!!
## , , = Homer
##
##
## sham DCZ
## clear 6 8
## opaque 7 9
##
## , , = Donut
##
##
## sham DCZ
## clear 7 10
## opaque 10 11
##Descriptions of sessions
Here we answer a few general questions on the sessions, choices,
repeats etc..
First, were there more trials (choices+misses+repeats) in DCZ
compared to sham sessions?
##
## Call:
## glm(formula = trial ~ Injection, family = "poisson", data = subset(agg.data4B1,
## singe == "Homer"))
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 3.11180 0.05852 53.175 < 2e-16 ***
## InjectionDCZ 0.31647 0.07303 4.334 1.47e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 62.021 on 29 degrees of freedom
## Residual deviance: 42.742 on 28 degrees of freedom
## AIC: 200.13
##
## Number of Fisher Scoring iterations: 4
##
## Call:
## glm(formula = trial ~ Injection * portes, family = "poisson",
## data = subset(agg.data4B1, singe == "Homer"))
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 3.07577 0.08771 35.069 <2e-16 ***
## InjectionDCZ 0.17750 0.11191 1.586 0.113
## portesopaque 0.06591 0.11775 0.560 0.576
## InjectionDCZ:portesopaque 0.24249 0.14782 1.640 0.101
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 62.021 on 29 degrees of freedom
## Residual deviance: 30.303 on 26 degrees of freedom
## AIC: 191.69
##
## Number of Fisher Scoring iterations: 4
##
## Call:
## glm(formula = trial ~ Injection, family = "poisson", data = subset(agg.data4B1,
## singe == "Homer" & portes == "opaque"))
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 3.14169 0.07857 39.987 < 2e-16 ***
## InjectionDCZ 0.41999 0.09658 4.349 1.37e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 43.391 on 15 degrees of freedom
## Residual deviance: 23.730 on 14 degrees of freedom
## AIC: 110.95
##
## Number of Fisher Scoring iterations: 4
##
## Call:
## glm(formula = trial ~ Injection, family = "poisson", data = subset(agg.data4B1,
## singe == "Homer" & portes == "clear"))
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 3.07577 0.08771 35.069 <2e-16 ***
## InjectionDCZ 0.17750 0.11191 1.586 0.113
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 9.1199 on 13 degrees of freedom
## Residual deviance: 6.5729 on 12 degrees of freedom
## AIC: 80.747
##
## Number of Fisher Scoring iterations: 4
##
## Call:
## glm(formula = trial ~ Injection, family = "poisson", data = subset(agg.data4B1,
## singe == "Donut"))
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 3.97472 0.03324 119.573 <2e-16 ***
## InjectionDCZ 0.06330 0.04410 1.436 0.151
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 512.47 on 37 degrees of freedom
## Residual deviance: 510.40 on 36 degrees of freedom
## AIC: 731.79
##
## Number of Fisher Scoring iterations: 4
##
## Call:
## glm(formula = trial ~ Injection * portes, family = "poisson",
## data = subset(agg.data4B1, singe == "Donut"))
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 3.35739 0.07053 47.599 <2e-16 ***
## InjectionDCZ -0.01101 0.09218 -0.119 0.905
## portesopaque 0.89680 0.07997 11.214 <2e-16 ***
## InjectionDCZ:portesopaque 0.16906 0.10497 1.611 0.107
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 512.465 on 37 degrees of freedom
## Residual deviance: 79.081 on 34 degrees of freedom
## AIC: 304.47
##
## Number of Fisher Scoring iterations: 4
##
## Call:
## glm(formula = trial ~ Injection, family = "poisson", data = subset(agg.data4B1,
## singe == "Donut" & portes == "opaque"))
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 4.25419 0.03769 112.877 < 2e-16 ***
## InjectionDCZ 0.15805 0.05023 3.147 0.00165 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 81.897 on 20 degrees of freedom
## Residual deviance: 71.940 on 19 degrees of freedom
## AIC: 205.15
##
## Number of Fisher Scoring iterations: 4
##
## Call:
## glm(formula = trial ~ Injection, family = "poisson", data = subset(agg.data4B1,
## singe == "Donut" & portes == "clear"))
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 3.35739 0.07053 47.599 <2e-16 ***
## InjectionDCZ -0.01101 0.09218 -0.119 0.905
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 7.1551 on 16 degrees of freedom
## Residual deviance: 7.1409 on 15 degrees of freedom
## AIC: 99.32
##
## Number of Fisher Scoring iterations: 4
Homer performs more trials in DCZ compared to sham (when all
conditions re taken together); not Donut.
But Statistics on Opaque (opaque) doors only shows an increase of
total number of trials in DCZ sessions compared to Sham for the two
monkeys.
##Figure1A
ggplot(agg.data4B1, aes(x=as.factor(Injection), y=trial , fill=Injection))+
geom_boxplot()+
geom_jitter(aes(color=Injection), width=0.1) +
facet_grid(singe~portes)+
scale_fill_manual(values=c("grey","chartreuse3","dodgerblue1"))+
scale_color_manual(values=c("grey50","chartreuse4","dodgerblue1"))+
ggtitle("Total number of trials in sessions")+
theme(axis.text.x = element_text(color = "grey20", size = 12))+
theme_classic()
Then we ask whether the last correct trial performed is later in DCZ
than in sham: this would mean that monkeys have more problems, or take
more time, to find all or the max of rewards.


##
## Call:
## glm(formula = trial_nb ~ Injection * portes, family = "poisson",
## data = subset(agg.maxcor, singe == "Homer"))
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 3.12090 0.08575 36.396 <2e-16 ***
## InjectionDCZ 0.16096 0.10976 1.466 0.1425
## portesopaque -0.09007 0.11937 -0.755 0.4505
## InjectionDCZ:portesopaque 0.29117 0.14952 1.947 0.0515 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 57.678 on 29 degrees of freedom
## Residual deviance: 33.086 on 26 degrees of freedom
## AIC: 193.39
##
## Number of Fisher Scoring iterations: 4
##
## Call:
## glm(formula = trial_nb ~ Injection, family = "poisson", data = subset(agg.maxcor,
## singe == "Homer" & portes == "opaque"))
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 3.03082 0.08305 36.496 < 2e-16 ***
## InjectionDCZ 0.45212 0.10154 4.453 8.47e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 43.139 on 15 degrees of freedom
## Residual deviance: 22.429 on 14 degrees of freedom
## AIC: 108.14
##
## Number of Fisher Scoring iterations: 4
##
## Call:
## glm(formula = trial_nb ~ Injection * portes, family = "poisson",
## data = subset(agg.maxcor, singe == "Donut"))
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 3.357395 0.070535 47.599 <2e-16 ***
## InjectionDCZ -0.003988 0.092041 -0.043 0.9654
## portesopaque 0.733611 0.081531 8.998 <2e-16 ***
## InjectionDCZ:portesopaque 0.205929 0.106706 1.930 0.0536 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 387.321 on 37 degrees of freedom
## Residual deviance: 82.512 on 34 degrees of freedom
## AIC: 305.01
##
## Number of Fisher Scoring iterations: 4
##
## Call:
## glm(formula = trial_nb ~ Injection, family = "poisson", data = subset(agg.maxcor,
## singe == "Donut" & portes == "opaque"))
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 4.09101 0.04089 100.042 < 2e-16 ***
## InjectionDCZ 0.20194 0.05399 3.741 0.000184 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 93.307 on 20 degrees of freedom
## Residual deviance: 79.199 on 19 degrees of freedom
## AIC: 209.38
##
## Number of Fisher Scoring iterations: 4
Both monkeys show a longer time to get to their last reward in
session especially in opaque condition (tendency 0.07) for Homer.
##Figure1B
ggplot(subset(agg.maxcor, portes=='opaque'), aes(x=Injection,y=trial_nb, fill=Injection))+
geom_boxplot()+
geom_jitter(aes(colour=Injection), size=2,width = 0.1)+
facet_grid(.~singe)+
scale_fill_manual(values=c("grey","chartreuse3","dodgerblue1"))+
scale_colour_manual(values=c("grey40","chartreuse4","dodgerblue1"))+
ggtitle("Last correct trial in sessions")+
theme(axis.text.x = element_text(color = "grey20", size = 12))+
theme_classic()
This might mean that trials are instead repeats although for Homer
there are more trials in sessions overall. So see let’s do the same
analysis for Repeats, and then analyze the Repeats altogether
In the first analysis we take only the “opaque” sessions because we
have very few repeats in “clear”:

##
## Call:
## glm(formula = trial_nb ~ Injection, family = "poisson", data = subset(agg.maxrpt,
## singe == "Homer"))
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 3.11668 0.07956 39.18 < 2e-16 ***
## InjectionDCZ 0.43229 0.09759 4.43 9.44e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 47.279 on 15 degrees of freedom
## Residual deviance: 26.844 on 14 degrees of freedom
## AIC: 113.71
##
## Number of Fisher Scoring iterations: 4
##
## Call:
## glm(formula = trial_nb ~ Injection, family = "poisson", data = subset(agg.maxrpt,
## singe == "Donut"))
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 4.27667 0.03727 114.755 < 2e-16 ***
## InjectionDCZ 0.16170 0.04963 3.258 0.00112 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 89.841 on 20 degrees of freedom
## Residual deviance: 79.164 on 19 degrees of freedom
## AIC: 212.84
##
## Number of Fisher Scoring iterations: 4
Main effect for both monkeys. THe last repeat trial is later in DCZ
than sham. Which goes with OR is equivalent to the fact their are more
trials made under DCZ.
Do monkeys (especially Homer) get more rewards in DCZ?


##
## Call:
## glm(formula = trial ~ Injection * portes, family = "poisson",
## data = subset(agg.NBcor, singe == "Homer"))
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 2.98736 0.09167 32.588 < 2e-16 ***
## InjectionDCZ 0.13720 0.11789 1.164 0.24450
## portesopaque -0.38998 0.13799 -2.826 0.00471 **
## InjectionDCZ:portesopaque 0.09207 0.17639 0.522 0.60170
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 34.811 on 29 degrees of freedom
## Residual deviance: 15.022 on 26 degrees of freedom
## AIC: 164.55
##
## Number of Fisher Scoring iterations: 4
##
## Call:
## glm(formula = trial ~ Injection, family = "poisson", data = subset(agg.NBcor,
## singe == "Homer" & portes == "opaque"))
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 2.5974 0.1031 25.183 <2e-16 ***
## InjectionDCZ 0.2293 0.1312 1.747 0.0806 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 12.6390 on 15 degrees of freedom
## Residual deviance: 9.5368 on 14 degrees of freedom
## AIC: 86.437
##
## Number of Fisher Scoring iterations: 4
##
## Call:
## glm(formula = trial ~ Injection, family = "poisson", data = subset(agg.NBcor,
## singe == "Homer" & portes == "clear"))
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 2.98736 0.09167 32.588 <2e-16 ***
## InjectionDCZ 0.13720 0.11789 1.164 0.244
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 6.8520 on 13 degrees of freedom
## Residual deviance: 5.4856 on 12 degrees of freedom
## AIC: 78.117
##
## Number of Fisher Scoring iterations: 4
##
## Call:
## glm(formula = trial ~ Injection * portes, family = "poisson",
## data = subset(agg.NBcor, singe == "Donut"))
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 3.17805 0.07715 41.192 <2e-16 ***
## InjectionDCZ 0.03279 0.09992 0.328 0.743
## portesopaque -0.06899 0.10206 -0.676 0.499
## InjectionDCZ:portesopaque 0.02860 0.13515 0.212 0.832
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 8.6493 on 37 degrees of freedom
## Residual deviance: 7.3892 on 34 degrees of freedom
## AIC: 205.64
##
## Number of Fisher Scoring iterations: 4
##
## Call:
## glm(formula = trial ~ Injection, family = "poisson", data = subset(agg.NBcor,
## singe == "Donut" & portes == "opaque"))
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 3.10906 0.06682 46.532 <2e-16 ***
## InjectionDCZ 0.06139 0.09100 0.675 0.5
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 6.9084 on 20 degrees of freedom
## Residual deviance: 6.4526 on 19 degrees of freedom
## AIC: 115
##
## Number of Fisher Scoring iterations: 4
##
## Call:
## glm(formula = trial ~ Injection, family = "poisson", data = subset(agg.NBcor,
## singe == "Donut" & portes == "clear"))
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 3.17805 0.07715 41.192 <2e-16 ***
## InjectionDCZ 0.03279 0.09992 0.328 0.743
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 1.04449 on 16 degrees of freedom
## Residual deviance: 0.93658 on 15 degrees of freedom
## AIC: 90.631
##
## Number of Fisher Scoring iterations: 3
There is a tendency for Homer to get more rewards in Opaque but not
significant, and not for Donut. [[ stats complicated here as numbers
saturate at 25)]]
Below we can graph the overall trends of choices across sessions. The
lines represent the fit to choice patterns (as shown in the very first
figures). Positive slopes means searching holes from top to bottom, and
negative slopes from bottom to top. The length actually covers the
number of trials.


There are changes regarding repeats but these are different for the 2
monkeys. Let’s test statistically the data for All trials, for <25
trials and for >25 trials:
Pause in sessions
Monkeys sometime break during the task for short (code 99: en general
prise d’info sur les autres singes) ; le singe reste de face ou de
profil par rapport à la PST ) or long (code 999: pause avec départ ; Le
singe n’est plus en face du setup ou/et s’engage dans une autre activité
(fouragement, jeu avec les chaines ou les mousquetons du setup, boit,
remonte sur son perchoir) ) pauses.
THere is an interest in looking at the number and distribution of
these pauses, as they may reflect laps/focus of attention,
distractibility, lack/increase of motivation, etc.


##
## Call:
## glm(formula = choice ~ Injection, family = "poisson", data = subset(shortp,
## singe == "Homer"))
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.4055 0.2582 1.570 0.116
## Injectionsham 0.2877 0.3873 0.743 0.458
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 7.2471 on 15 degrees of freedom
## Residual deviance: 6.7030 on 14 degrees of freedom
## AIC: 48.48
##
## Number of Fisher Scoring iterations: 5
##
## Call:
## glm(formula = choice ~ Injection, family = "poisson", data = subset(shortp,
## singe == "Donut"))
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.0116 0.1741 5.811 6.2e-09 ***
## Injectionsham -0.2167 0.2501 -0.866 0.386
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 19.586 on 25 degrees of freedom
## Residual deviance: 18.835 on 24 degrees of freedom
## AIC: 92.272
##
## Number of Fisher Scoring iterations: 4



## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: poisson ( log )
## Formula: trial_nb ~ Injection + (1 | singe)
## Data: short.pause
##
## AIC BIC logLik deviance df.resid
## 1660.9 1668.4 -827.4 1654.9 88
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -6.4590 -2.9481 0.5138 2.3374 7.0528
##
## Random effects:
## Groups Name Variance Std.Dev.
## singe (Intercept) 0.306 0.5532
## Number of obs: 91, groups: singe, 2
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 3.48352 0.39220 8.882 < 2e-16 ***
## Injectionsham -0.19059 0.03282 -5.807 6.34e-09 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## Injectinshm -0.035
##
## Call:
## glm(formula = trial_nb ~ Injection, family = "poisson", data = subset(short.pause,
## singe == "Homer"))
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 2.90872 0.06030 48.236 <2e-16 ***
## Injectionsham -0.14135 0.09419 -1.501 0.133
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 191.63 on 26 degrees of freedom
## Residual deviance: 189.36 on 25 degrees of freedom
## AIC: 313.22
##
## Number of Fisher Scoring iterations: 5
##
## Call:
## glm(formula = trial_nb ~ Injection, family = "poisson", data = subset(short.pause,
## singe == "Donut"))
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 4.03932 0.02310 174.86 < 2e-16 ***
## Injectionsham -0.19745 0.03501 -5.64 1.7e-08 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 1005.86 on 63 degrees of freedom
## Residual deviance: 973.83 on 62 degrees of freedom
## AIC: 1335.4
##
## Number of Fisher Scoring iterations: 5
Statistics show that across monkeys pauses are made earlier in sham
compared to DCZ. (significant for both monkeys together or
individually)
##Figure2A
cc <- ggplot(shortp, aes(x=Injection, y=choice, fill=Injection))+
geom_boxplot()+
geom_jitter(aes(colour=Injection),size= 2, width=.1)+
facet_grid(. ~ singe)+
scale_fill_manual(values=c("chartreuse3","grey"))+
scale_colour_manual(values=c("chartreuse4","grey60"))+
ggtitle("Number of SHORT pauses during sessions")+
theme(title =element_text(size=8, face='bold'),axis.text.x = element_text(color = "grey20", size = 12))+
ylim(0,8) + theme_classic() +
theme(legend.position="none")
bb <- ggplot(short.pause, aes(x= Injection, y=trial_nb, fill=Injection))+
geom_boxplot(aes(colour=Injection))+coord_flip()+
geom_jitter(aes(colour=Injection), width=0.1)+
facet_grid(singe ~ .)+
scale_fill_manual(values=c("chartreuse3","grey"))+
scale_colour_manual(values=c("chartreuse4","grey60"))+
ggtitle("Distribution of short pauses ")+
theme(title =element_text(size=9, face='bold'), axis.text.x = element_text(color = "grey20", size = 10)) + theme_classic()
grid.arrange(cc, bb, ncol=2)
Trial types:
let’s look at the frequency of repeats, miss, etc…

##
## Call:
## glm(formula = trial ~ choice_type/Injection, family = "poisson",
## data = subset(agg.data4B, singe == "Homer" & portes == "clear"))
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 2.98736 0.09167 32.588 < 2e-16 ***
## choice_typeMiss -2.47654 0.45651 -5.425 5.80e-08 ***
## choice_typeRepeat -2.29422 0.41841 -5.483 4.18e-08 ***
## choice_typeCorrect:InjectionDCZ 0.13720 0.11789 1.164 0.2445
## choice_typeMiss:InjectionDCZ 0.35417 0.50262 0.705 0.4810
## choice_typeRepeat:InjectionDCZ 1.09861 0.57735 1.903 0.0571 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 274.647 on 28 degrees of freedom
## Residual deviance: 11.695 on 23 degrees of freedom
## AIC: 132.12
##
## Number of Fisher Scoring iterations: 4
##
## Call:
## glm(formula = trial ~ choice_type/Injection, family = "poisson",
## data = subset(agg.data4B, singe == "Homer" & portes == "opaque"))
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 2.59738 0.10314 25.183 < 2e-16 ***
## choice_typeMiss -1.43423 0.27044 -5.303 1.14e-07 ***
## choice_typeRepeat -0.59205 0.17283 -3.426 0.000613 ***
## choice_typeCorrect:InjectionDCZ 0.22927 0.13121 1.747 0.080585 .
## choice_typeMiss:InjectionDCZ 0.08961 0.31339 0.286 0.774921
## choice_typeRepeat:InjectionDCZ 0.71742 0.16288 4.405 1.06e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 183.374 on 44 degrees of freedom
## Residual deviance: 39.504 on 39 degrees of freedom
## AIC: 231.19
##
## Number of Fisher Scoring iterations: 4
##
## Call:
## glm(formula = trial ~ choice_type/Injection, family = "poisson",
## data = subset(agg.data4B, singe == "Donut" & portes == "clear"))
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 3.17805 0.07715 41.192 < 2e-16 ***
## choice_typeMiss -1.52940 0.21075 -7.257 3.96e-13 ***
## choice_typeRepeat -2.61844 0.38576 -6.788 1.14e-11 ***
## choice_typeCorrect:InjectionDCZ 0.03279 0.09992 0.328 0.743
## choice_typeMiss:InjectionDCZ -0.41190 0.26593 -1.549 0.121
## choice_typeRepeat:InjectionDCZ 1.04982 0.58554 1.793 0.073 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 332.6456 on 35 degrees of freedom
## Residual deviance: 8.5136 on 30 degrees of freedom
## AIC: 164.28
##
## Number of Fisher Scoring iterations: 4
##
## Call:
## glm(formula = trial ~ choice_type/Injection, family = "poisson",
## data = subset(agg.data4B, singe == "Donut" & portes == "opaque"))
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 3.10906 0.06682 46.532 < 2e-16 ***
## choice_typeMiss -0.58333 0.11164 -5.225 1.74e-07 ***
## choice_typeRepeat 0.46047 0.08533 5.396 6.80e-08 ***
## choice_typeCorrect:InjectionDCZ 0.06139 0.09100 0.675 0.500
## choice_typeMiss:InjectionDCZ -0.18743 0.12950 -1.447 0.148
## choice_typeRepeat:InjectionDCZ 0.30733 0.06856 4.483 7.36e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 621.09 on 62 degrees of freedom
## Residual deviance: 194.79 on 57 degrees of freedom
## AIC: 512.65
##
## Number of Fisher Scoring iterations: 4

##
## Call:
## glm(formula = trial ~ choice_type/Injection, family = "poisson",
## data = subset(agg.data4B.first30, singe == "Homer" & portes ==
## "clear"))
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 2.98736 0.09167 32.588 < 2e-16 ***
## choice_typeMiss -2.47654 0.45651 -5.425 5.80e-08 ***
## choice_typeRepeat -2.29422 0.41841 -5.483 4.18e-08 ***
## choice_typeCorrect:InjectionDCZ 0.12615 0.11815 1.068 0.286
## choice_typeMiss:InjectionDCZ 0.35417 0.50262 0.705 0.481
## choice_typeRepeat:InjectionDCZ 0.91629 0.60553 1.513 0.130
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 273.22 on 28 degrees of freedom
## Residual deviance: 11.46 on 23 degrees of freedom
## AIC: 131.63
##
## Number of Fisher Scoring iterations: 4
##
## Call:
## glm(formula = trial ~ choice_type/Injection, family = "poisson",
## data = subset(agg.data4B.first30, singe == "Donut" & portes ==
## "clear"))
##
## Coefficients: (1 not defined because of singularities)
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 3.16004 0.07785 40.591 < 2e-16 ***
## choice_typeMiss -1.51138 0.21100 -7.163 7.9e-13 ***
## choice_typeRepeat -2.46689 0.71138 -3.468 0.000525 ***
## choice_typeCorrect:InjectionDCZ 0.05081 0.10046 0.506 0.613039
## choice_typeMiss:InjectionDCZ -0.41190 0.26593 -1.549 0.121411
## choice_typeRepeat:InjectionDCZ NA NA NA NA
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 267.0122 on 31 degrees of freedom
## Residual deviance: 6.9735 on 27 degrees of freedom
## AIC: 150.15
##
## Number of Fisher Scoring iterations: 4
##
## Call:
## glm(formula = trial ~ choice_type/Injection, family = "poisson",
## data = subset(agg.data4B.first30, singe == "Homer" & portes ==
## "opaque"))
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 2.59738 0.10314 25.183 < 2e-16 ***
## choice_typeMiss -1.43423 0.27044 -5.303 1.14e-07 ***
## choice_typeRepeat -0.59205 0.17283 -3.426 0.000613 ***
## choice_typeCorrect:InjectionDCZ 0.13986 0.13354 1.047 0.294927
## choice_typeMiss:InjectionDCZ -0.06454 0.32275 -0.200 0.841507
## choice_typeRepeat:InjectionDCZ 0.37215 0.17187 2.165 0.030366 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 136.831 on 44 degrees of freedom
## Residual deviance: 16.988 on 39 degrees of freedom
## AIC: 204.28
##
## Number of Fisher Scoring iterations: 4
##
## Call:
## glm(formula = trial ~ choice_type/Injection, family = "poisson",
## data = subset(agg.data4B.first30, singe == "Donut" & portes ==
## "opaque"))
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 2.63189 0.08482 31.030 < 2e-16 ***
## choice_typeMiss -0.26165 0.12861 -2.034 0.0419 *
## choice_typeRepeat -0.98323 0.16256 -6.049 1.46e-09 ***
## choice_typeCorrect:InjectionDCZ 0.12351 0.11391 1.084 0.2782
## choice_typeMiss:InjectionDCZ -0.32549 0.14529 -2.240 0.0251 *
## choice_typeRepeat:InjectionDCZ 0.20194 0.18307 1.103 0.2700
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 156.860 on 62 degrees of freedom
## Residual deviance: 61.304 on 57 degrees of freedom
## AIC: 325.89
##
## Number of Fisher Scoring iterations: 4
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: poisson ( log )
## Formula: trial ~ choice_type/Injection + (1 | singe)
## Data: subset(agg.data4B.first30, portes == "opaque")
##
## AIC BIC logLik deviance df.resid
## 581.4 600.2 -283.7 567.4 101
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.5143 -0.8562 -0.0476 0.6219 3.7715
##
## Random effects:
## Groups Name Variance Std.Dev.
## singe (Intercept) 0 0
## Number of obs: 108, groups: singe, 2
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 2.61783 0.06551 39.959 < 2e-16 ***
## choice_typeMiss -0.51369 0.11145 -4.609 4.05e-06 ***
## choice_typeRepeat -0.80665 0.11793 -6.840 7.91e-12 ***
## choice_typeCorrect:InjectionDCZ 0.12945 0.08659 1.495 0.13491
## choice_typeMiss:InjectionDCZ -0.35723 0.13155 -2.716 0.00662 **
## choice_typeRepeat:InjectionDCZ 0.31108 0.12491 2.490 0.01276 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) chc_tM chc_tR c_C:ID c_M:ID
## choc_typMss -0.588
## choc_typRpt -0.556 0.327
## chc_tC:IDCZ -0.757 0.445 0.420
## chc_tM:IDCZ 0.000 -0.555 0.000 0.000
## chc_tR:IDCZ 0.000 0.000 -0.653 0.000 0.000
## optimizer (Nelder_Mead) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
The stats shows that when All trials are taken into account
, both animals made more REpeats in DCZ than in Sham. (This is probably
linked to the increased number of trials).
We analyzed the 30 first trials to check whether changes in
the strategy or efficiency of the animals could be detected.THe average
number of Miss is reduced in bpth monkeys but it is significant (with
the full model) only for Donut. In the mixed model with both monkeys
(Random factor) we find increased number of REPEATS and decreased number
of MISS
##XYplot trial types



##
## Call:
## glm(formula = Repeat_trials ~ Correct_trials * Injection, data = subset(xyplot_data.first30,
## singe == "Homer"))
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 9.6250 2.6509 3.631 0.00178 **
## Correct_trials -0.2500 0.2018 -1.239 0.23057
## InjectionDCZ 8.0777 3.2681 2.472 0.02307 *
## Correct_trials:InjectionDCZ -0.2010 0.2354 -0.854 0.40384
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for gaussian family taken to be 1.140645)
##
## Null deviance: 135.304 on 22 degrees of freedom
## Residual deviance: 21.672 on 19 degrees of freedom
## AIC: 73.904
##
## Number of Fisher Scoring iterations: 2
##
## Call:
## glm(formula = Repeat_trials ~ Correct_trials * Injection, data = subset(xyplot_data.first30,
## singe == "Donut"))
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -1.4741 2.7541 -0.535 0.5970
## Correct_trials 0.4793 0.2020 2.372 0.0254 *
## InjectionDCZ 8.1117 4.5915 1.767 0.0890 .
## Correct_trials:InjectionDCZ -0.5196 0.3062 -1.697 0.1017
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for gaussian family taken to be 3.945685)
##
## Null deviance: 133.37 on 29 degrees of freedom
## Residual deviance: 102.59 on 26 degrees of freedom
## AIC: 132.02
##
## Number of Fisher Scoring iterations: 2

The statistics show that there is no effect of the condition
(Injection) for Homer but there is a significant increase of repeat for
Donut. This is when we do not take PORTES into account. If Portes is
used as an interacting fixed effect the effect size for Repeats in Donut
goes down (p=0.052).
Cumsum Reward
Test whether the speed of getting rewards changes between conditions
and under DCZ vs sham.



##
## Exact two-sample Kolmogorov-Smirnov test
##
## data: cum$cv[cum$portes == "opaque" & cum$singe == "Homer" & cum$Injection == "sham"] and cum$cv[cum$portes == "opaque" & cum$singe == "Homer" & cum$Injection == "DCZ"]
## D = 0.41818, p-value = 0.002047
## alternative hypothesis: two-sided
##
## Exact two-sample Kolmogorov-Smirnov test
##
## data: cum$cv[cum$portes == "opaque" & cum$singe == "Donut" & cum$Injection == "sham"] and cum$cv[cum$portes == "opaque" & cum$singe == "Donut" & cum$Injection == "DCZ"]
## D = 0.18313, p-value = 0.06072
## alternative hypothesis: two-sided

##
## Exact two-sample Kolmogorov-Smirnov test
##
## data: cum30$cv[cum30$portes == "opaque" & cum30$singe == "Homer" & cum30$Injection == "sham"] and cum30$cv[cum30$portes == "opaque" & cum30$singe == "Homer" & cum30$Injection == "DCZ"]
## D = 0.36143, p-value = 0.01305
## alternative hypothesis: two-sided
##
## Exact two-sample Kolmogorov-Smirnov test
##
## data: cum30$cv[cum30$portes == "opaque" & cum30$singe == "Donut" & cum30$Injection == "sham"] and cum30$cv[cum30$portes == "opaque" & cum30$singe == "Donut" & cum30$Injection == "DCZ"]
## D = 0.1, p-value = 0.966
## alternative hypothesis: two-sided
There is an impact of DCZ on the speed at which animals get rewards
under DCZ compared to Sham, in the opaque condition, not in the clear.
Specifically it seems that animals accumulate rewards faster under
DCZ.IT is not significant if one takes only the first 50 trials for the
2 animals
One possibility is that it’s because animals make less repeats at the
begining thus cumulating rewards faster.
Cumsum repeats
Test whether the repeats appear later using a cumsum curve
No different.
##stats spatial strategy

There is no difference in distribution of distances between
sham and DCZ.
Clusters of small distances
We look at clustering in the sense of succession of choices at small
distances.




##
## Call:
## lm(formula = normdist ~ portes.x * Injection.x, data = subset(newdata2,
## singe.x == "Donut"))
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.80139 -0.14844 0.00233 0.18909 0.51287
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.5184 0.1198 12.671 1.97e-14 ***
## portes.xopaque 0.1249 0.1562 0.799 0.430
## Injection.xDCZ 0.1497 0.1562 0.958 0.345
## portes.xopaque:Injection.xDCZ -0.1053 0.2088 -0.504 0.617
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.317 on 34 degrees of freedom
## Multiple R-squared: 0.03841, Adjusted R-squared: -0.04644
## F-statistic: 0.4527 on 3 and 34 DF, p-value: 0.7171
##
## Call:
## lm(formula = normdist ~ portes.x * Injection.x, data = subset(newdata2,
## singe.x == "Homer"))
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.81273 -0.16082 -0.01963 0.12806 0.69782
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.58441 0.12304 12.877 8.64e-13 ***
## portes.xopaque 0.14314 0.16768 0.854 0.401
## Injection.xDCZ -0.08747 0.16277 -0.537 0.596
## portes.xopaque:Injection.xDCZ 0.06950 0.22263 0.312 0.757
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.3014 on 26 degrees of freedom
## Multiple R-squared: 0.1052, Adjusted R-squared: 0.001928
## F-statistic: 1.019 on 3 and 26 DF, p-value: 0.4004

##
## Call:
## glm(formula = clust ~ portes * Injection, family = "poisson",
## data = subset(distClustyClust.session, singe == "Donut"))
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.89948 0.24106 3.731 0.00019 ***
## portesopaque 0.27954 0.29811 0.938 0.34840
## InjectionDCZ 0.07956 0.30932 0.257 0.79702
## portesopaque:InjectionDCZ -0.09763 0.39358 -0.248 0.80409
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 5.2827 on 37 degrees of freedom
## Residual deviance: 3.8751 on 34 degrees of freedom
## AIC: Inf
##
## Number of Fisher Scoring iterations: 4
##
## Call:
## glm(formula = clust ~ portes * Injection, family = "poisson",
## data = subset(distClustyClust.session, singe == "Homer"))
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.87547 0.26352 3.322 0.000893 ***
## portesopaque 0.13179 0.34874 0.378 0.705493
## InjectionDCZ -0.01223 0.34953 -0.035 0.972094
## portesopaque:InjectionDCZ -0.11073 0.46929 -0.236 0.813465
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 2.0457 on 29 degrees of freedom
## Residual deviance: 1.7967 on 26 degrees of freedom
## AIC: Inf
##
## Number of Fisher Scoring iterations: 4

##
## Call:
## lm(formula = normclust ~ portes.x * Injection.x, data = subset(newdata2,
## singe.x == "Donut"))
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.085162 -0.019141 0.002136 0.012457 0.129248
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.113176 0.016030 7.060 3.75e-08 ***
## portes.xopaque 0.046286 0.020900 2.215 0.0336 *
## Injection.xDCZ 0.007701 0.020900 0.368 0.7148
## portes.xopaque:Injection.xDCZ -0.007854 0.027932 -0.281 0.7803
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.04241 on 34 degrees of freedom
## Multiple R-squared: 0.2131, Adjusted R-squared: 0.1437
## F-statistic: 3.069 on 3 and 34 DF, p-value: 0.04085
##
## Call:
## lm(formula = normclust ~ portes.x * Injection.x, data = subset(newdata2,
## singe.x == "Homer"))
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.127614 -0.037568 -0.000705 0.039737 0.105619
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.15299 0.02148 7.123 1.45e-07 ***
## portes.xopaque 0.01176 0.02927 0.402 0.691
## Injection.xDCZ -0.03721 0.02841 -1.310 0.202
## portes.xopaque:Injection.xDCZ 0.03711 0.03886 0.955 0.348
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.05261 on 26 degrees of freedom
## Multiple R-squared: 0.1516, Adjusted R-squared: 0.05371
## F-statistic: 1.549 on 3 and 26 DF, p-value: 0.2257
After counting and normalizing we don’t find any difference in the
clustering of distances between choices: no difference in the number of
choices Hence the strategy of the animal, in terms of clustering choices
with small distances, don’t seem to differ.
Note that surprisingly only Donut shows the effect in which the
number of cluster with short distances is larger in opaque than in Clear
conditions. Homer does not seem to change his strategy in that regard
between the 2…
However, this is surprising because analyses and figures above
suggest that under rDCZ in opaque animals get rewards faster and that it
could be accompanied by more short distances between 2 successive
choices. !! NEED to investigate further!!
Cumsum distance - trajectory
Test whether the speed of getting rewards changes between conditions
and under DCZ vs sham.
POST-OUTCOME reaction vs Reward
Test whether the choices made after no rewards (e.g. next distance of
choice: close or far). We hypothesize that in the opaque condition (the
animal doesn’t see rewards) the distance after negative outcomes (for a
repeat) is larger than after a correct rewarded response, because when
rewarded the animal will stay ‘in the patch’ i.e. close to where he got
the reward.
We remove Clear conditions, and misses because it’s not
appropriate.




## Linear mixed-effects model fit by REML
## Data: subset(mean.nextdist, Injection == "sham")
## AIC BIC logLik
## 257.6596 265.5407 -124.8298
##
## Random effects:
## Formula: ~1 | singe
## (Intercept) Residual
## StdDev: 9.748496e-05 2.396026
##
## Fixed effects: nextdist ~ choice_type
## Value Std.Error DF t-value p-value
## (Intercept) 9.526671 0.4611155 52 20.660054 0.0000
## choice_typeRepeat 1.721628 0.6462671 52 2.663957 0.0103
## Correlation:
## (Intr)
## choice_typeRepeat -0.714
##
## Standardized Within-Group Residuals:
## Min Q1 Med Q3 Max
## -1.9817389 -0.5213904 -0.1182803 0.4321110 3.4439110
##
## Number of Observations: 55
## Number of Groups: 2
## numDF denDF F-value p-value
## (Intercept) 1 52 1036.8311 <.0001
## choice_type 1 52 7.0967 0.0103
## Linear mixed-effects model fit by REML
## Data: mean.nextdist
## AIC BIC logLik
## 648.313 665.4252 -318.1565
##
## Random effects:
## Formula: ~1 | singe
## (Intercept) Residual
## StdDev: 0.6385261 2.73632
##
## Fixed effects: nextdist ~ Injection * choice_type
## Value Std.Error DF t-value p-value
## (Intercept) 9.716682 0.7016593 127 13.848148 0.0000
## InjectionDCZ 0.586587 0.6955482 127 0.843345 0.4006
## choice_typeRepeat 1.700747 0.7381438 127 2.304086 0.0228
## InjectionDCZ:choice_typeRepeat -0.215577 0.9666098 127 -0.223024 0.8239
## Correlation:
## (Intr) InjDCZ chc_tR
## InjectionDCZ -0.582
## choice_typeRepeat -0.538 0.542
## InjectionDCZ:choice_typeRepeat 0.408 -0.713 -0.763
##
## Standardized Within-Group Residuals:
## Min Q1 Med Q3 Max
## -1.8612082 -0.6587507 -0.1052453 0.3905203 3.7617502
##
## Number of Observations: 132
## Number of Groups: 2
## numDF denDF F-value p-value
## (Intercept) 1 127 448.6231 <.0001
## Injection 1 127 0.9869 0.3224
## choice_type 1 127 10.9104 0.0012
## Injection:choice_type 1 127 0.0497 0.8239
##
## Call:
## lm(formula = nextdist ~ Injection * choice_type, data = subset(mean.nextdist,
## singe == "Donut" & portes == "opaque"))
##
## Residuals:
## Min 1Q Median 3Q Max
## -4.9170 -1.3114 -0.1794 0.8692 10.3125
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 9.32160 0.55640 16.753 < 2e-16 ***
## InjectionDCZ -0.08127 0.76878 -0.106 0.91607
## choice_typeRepeat 2.09544 0.78687 2.663 0.00936 **
## InjectionDCZ:choice_typeRepeat 0.03893 1.08722 0.036 0.97153
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2.488 on 80 degrees of freedom
## Multiple R-squared: 0.1596, Adjusted R-squared: 0.1281
## F-statistic: 5.066 on 3 and 80 DF, p-value: 0.002906
##
## Call:
## lm(formula = nextdist ~ Injection * choice_type, data = subset(mean.nextdist,
## singe == "Homer" & portes == "opaque"))
##
## Residuals:
## Min 1Q Median 3Q Max
## -5.1781 -2.3404 -0.7444 1.9236 8.8767
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 10.1126 1.1708 8.637 5e-11 ***
## InjectionDCZ 1.5655 1.4179 1.104 0.276
## choice_typeRepeat 0.7139 1.6032 0.445 0.658
## InjectionDCZ:choice_typeRepeat -0.1855 1.9347 -0.096 0.924
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 3.098 on 44 degrees of freedom
## Multiple R-squared: 0.05919, Adjusted R-squared: -0.004961
## F-statistic: 0.9227 on 3 and 44 DF, p-value: 0.4378
We observe a post-error effect: after a repeat (negative outcome) the
next choice is further away than after a rewarded choice. The effect is
however not significant for Homer. There is no DCZ effect in both.
##Figure2B
ggplot(mean.nextdist, aes(choice_type, y=nextdist, fill=choice_type))+
geom_boxplot(outlier.shape = NA)+
geom_point(aes(colour=Injection), position = position_jitterdodge())+
facet_grid(singe~ Injection)+
ylim(5,18)+
ylab('Distance to next choice (cm)')+
scale_fill_manual(values=c("grey30","grey60"))+
scale_colour_manual(values=c("grey40","chartreuse3"))+
ggtitle("Euclidian distance to the next choice \n after positive or negative outcomes")+
theme_classic()
Other option is to check whether the probability to do a short
vs. long shift depends on the previous reward, using logistic
regressions.
Now how does this work with successive trials : does the cumulative
outcome (e.g. average outcome in 5 last choices) impact the distance of
leave after a negative outcome? The hypothesis is that there should be a
threshold to “leave the patch” in terms of average reward encountered.
We don’t look first at average values but at successions of rwd: ..010,
.0110, 01110, 11110

##
## Call:
## lm(formula = distNeg ~ Value * Injection, data = subset(MeanValueNeg.nextdist,
## singe == "Donut" & Feedback == "Negative"))
##
## Residuals:
## Min 1Q Median 3Q Max
## -5.4737 -1.8890 -0.5073 1.3366 15.1996
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 9.9035 0.8081 12.256 < 2e-16 ***
## Value 2.5877 1.7672 1.464 0.14613
## InjectionDCZ 1.9929 1.1164 1.785 0.07714 .
## Value:InjectionDCZ -6.9720 2.3866 -2.921 0.00428 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 3.323 on 104 degrees of freedom
## Multiple R-squared: 0.09425, Adjusted R-squared: 0.06812
## F-statistic: 3.607 on 3 and 104 DF, p-value: 0.01586
##
## Call:
## lm(formula = distNeg ~ Value * Injection, data = subset(MeanValueNeg.nextdist,
## singe == "Homer" & Feedback == "Negative"))
##
## Residuals:
## Min 1Q Median 3Q Max
## -8.7392 -2.7161 -0.8982 1.6590 20.5108
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 14.492 2.377 6.097 6.3e-08 ***
## Value -7.211 4.229 -1.705 0.0929 .
## InjectionDCZ -3.241 2.800 -1.158 0.2512
## Value:InjectionDCZ 8.133 5.130 1.585 0.1177
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 4.889 on 66 degrees of freedom
## Multiple R-squared: 0.05137, Adjusted R-squared: 0.008255
## F-statistic: 1.191 on 3 and 66 DF, p-value: 0.3199
Distance to repeat

##
## Call:
## glm(formula = d2rpt ~ Injection, family = "poisson", data = subset(stats.repeat,
## singe == "Homer" & portes == "opaque"))
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 2.06142 0.05096 40.448 < 2e-16 ***
## InjectionDCZ 0.23373 0.05782 4.042 5.3e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 844.63 on 183 degrees of freedom
## Residual deviance: 827.59 on 182 degrees of freedom
## AIC: 1532.8
##
## Number of Fisher Scoring iterations: 5
##
## Call:
## glm(formula = d2rpt ~ Injection, family = "poisson", data = subset(stats.repeat,
## singe == "Donut" & portes == "opaque"))
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 2.69952 0.01380 195.598 < 2e-16 ***
## InjectionDCZ 0.06016 0.01763 3.412 0.000645 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 5717.5 on 878 degrees of freedom
## Residual deviance: 5705.8 on 877 degrees of freedom
## AIC: 9535
##
## Number of Fisher Scoring iterations: 5
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: poisson ( log )
## Formula: d2rpt ~ Injection + (1 | singe)
## Data: subset(stats.repeat, portes == "opaque")
##
## AIC BIC logLik deviance df.resid
## 11087.8 11102.7 -5540.9 11081.8 1060
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.7344 -1.8032 -0.7234 1.2839 13.3588
##
## Random effects:
## Groups Name Variance Std.Dev.
## singe (Intercept) 0.06424 0.2535
## Number of obs: 1063, groups: singe, 2
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 2.43701 0.18005 13.535 < 2e-16 ***
## InjectionDCZ 0.07538 0.01683 4.479 7.49e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## InjectinDCZ -0.064
Regarding distances between a choice and its repeat, DCZ effects are
present for both monkeys -> distances are longer under DCZ in opaque
conditions.
##Figure1C
ggplot( data=subset(stats.repeat, portes=="opaque"), aes(x = d2rpt, color = Injection))+
geom_density(aes(fill=Injection),size=1, alpha=.5)+
facet_grid(singe~ portes)+
geom_vline(data=medD2rpt, aes(xintercept = median, color=Injection), linetype="dashed", size=1)+
scale_color_manual(values=c("grey40","chartreuse3","dodgerblue1"))+
scale_fill_manual(values=c("grey40","chartreuse3","dodgerblue1"))+
ggtitle('distance between a choice and its repetition')+
theme_classic()
2D choices
Script below is to make moving graph of choices… for fun